<template>
  <div id="app">
    <!-- 头部 -->
    <el-card class="box-card">
      <div slot="header" class="clearfix">演示用户的增删改查</div>
    </el-card>
    <!-- 内容 -->
    <el-table :data="list" border style="width: 100%">
      <el-table-column prop="id" label="ID" width="180"></el-table-column>
      <el-table-column prop="name" label="用户名" width="180"></el-table-column>
      <el-table-column prop="mima" label="密码"></el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-pagination
      @size-change="getList"
      @current-change="getList"
      :current-page.sync="pagenum"
      :page-sizes="[3, 5, 10]"
      :page-size.sync="pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
</template>
<script>
import axios from "axios"
export default {
  data() {
    return {
      list: [],
      pagenum:1,
      pagesize:3,
      total:0
    };
  },
  created() {
   this.getList();
  },
  methods: {
    getList(){
      axios.get("/user",{params:{
        pagenum:this.pagenum,
        pagesize:this.pagesize
      }}).then(res => {
        console.log(res.data)
        this.list = res.data.res;
         this.total = res.data.total;
    });
    }
  },
};
</script>
<style lang="scss">
html,
body {
  margin: 0;
  height: 100%;
}
#app {
  height: 100%;
}
</style>
